
function generateCheckAll(checkbox_id, list_id) {
    return function(){
        if (document.getElementById(checkbox_id).checked) {
            var arr = new Array()
            $('#'+list_id+' option').each(function(index, e){arr.push($(e).val())});
            $('#'+list_id).val(arr).trigger('liszt:updated');
        }
        else {
            $('#'+list_id).val([]).trigger('liszt:updated');
        }
    }
}